import 'package:flutter_test/flutter_test.dart';
import 'package:ota_update/ota_update.dart';
import 'package:ota_update/ota_update_platform_interface.dart';
import 'package:ota_update/ota_update_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockOtaUpdatePlatform
    with MockPlatformInterfaceMixin
    implements OtaUpdatePlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final OtaUpdatePlatform initialPlatform = OtaUpdatePlatform.instance;

  test('$MethodChannelOtaUpdate is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelOtaUpdate>());
  });

  test('getPlatformVersion', () async {
    OtaUpdate otaUpdatePlugin = OtaUpdate();
    MockOtaUpdatePlatform fakePlatform = MockOtaUpdatePlatform();
    OtaUpdatePlatform.instance = fakePlatform;

    expect(await otaUpdatePlugin.getPlatformVersion(), '42');
  });
}
